package org.zxp.onedoteight.lambda;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;
import java.util.function.Function;

/**
 * @program: effectiveJava
 * @description:
 * @author: X-Pacific zhang
 * @create: 2020-03-19 17:58
 **/
public class MethodQuote {

    @Test
    public void test1(){
        // 这个是正确的
        Runnable runnable = this::test1;
        //这个会报错
//        Runnable runnable2 = this::dooooo;
        //这个是正确的
        Function f1 = this::dooooo;
    }

    public Object dooooo(Object oo){
        return null;
    }

    @Test
    public void test2(){
        // 没有函数引用，直接用lambda
        new Thread(() -> {this.dooooo2();}).start();
        //用函数引用
        new Thread(this::dooooo2).start();
    }

    public void dooooo2(){
        System.out.println("dooooo2");
    }


}
